<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>行为记录表</title>
    <link rel="stylesheet" href="<%=basePath%>css/record.css">
    <script type="text/javascript" src="js/jquery-1.12.0.min.js"></script>
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        //1.将做的是根据id删除表中数据的操作
        function deleteByBehavior(id) {
            //alert("111");
            var f = confirm("你确认要删除吗？");
            if (f) {
                document.getElementById("bid").value = id;
                var formb = document.getElementById("formb");
                formb.submit();
            }
        }

        //2.导出Excel的操作
        function findexcel() {
            location.href = "findExcel";

        }

        //3.根据id查询出数据
        function findById(bid) {
            location.href = "findByid/" + bid;

        }

        $(document).ready(function () {
            $("#button1").click(function () {
                //alert("1111");
                //console.log( $("#sname").val().length);
                if ($("#btype").val().length == 0 || $("#code").val().length == 0 || $("#regular").val().length == 0 || $("#bDate").val().length == 0 || $("#servious").val().length == 0) {
                    alert('姓名，类型，规程编号，条款号，日期,严重度为必填的，请仔细填写---');
                } else {
                    var insertForm1 = document.getElementById("behaviorForm1");
                    insertForm1.submit();
                }
            });
        });

        function gotoPage(pageNo) {
            var inputPage = document.getElementById("inputPage").value;
            var totalPage =${requestScope.list.totalPages};
            if (inputPage <= totalPage) {
                if (pageNo == 0) {
                    //pageNo为当前页数，setPagesize当前页的大小
                    document.getElementById("pageNo").value = document.getElementById("inputPage").value;
                    document.getElementById("setPageSize").value = document.getElementById("getPageSize").value;
                } else {

                    document.getElementById("pageNo").value = pageNo;
                }
                var forms = document.getElementById("form2");
                //跳转到查询出销售表数据的接口中去
                forms.action = "findBehavior";
                forms.submit();
            }
        }

        function copyOne(id) {
            location.href = "copyBehaviour/" + id;
        }
    </script>
</head>
<body>
<div class="box">
    <form action="deleteBehaviorID" id="formb">
        <input type="hidden" name="bid" id="bid"/>

    </form>
    <div class="set-on">
        <span><a href="<%=basePath%>tojump">首页</a></span>
        <a href="javaScript:findexcel()" class="daochu">导出Excel</a>
        <!-- <a href="javaScript:findAllLog()">操作日志</a> -->
    </div>
    <form id="form2" action="findBehavior" method="post">
        <input type="hidden" name="pageNo" id="pageNo" value="${list.pageNo}">
        <input type="hidden" name="setPageSize" id="setPageSize" value="${list.pageSize}">
        <table id="rec_tab">
            <caption class="cap">行为记录</caption>
            <tr class="info">
                <th>序号</th>
                <th>姓名</th>
                <th>类别</th>
                <th>规程编号</th>
                <th>条款号</th>
                <th>条款内容</th>
                <th>行为情况</th>
                <th>日期</th>
                <th>严重度</th>
                <th>记录人</th>
                <th>计划处罚金额</th>
                <th>已交处罚金额</th>
                <th>备注说明</th>
                <%--<th>其他2</th>--%>
                <%--<th>其他3</th>--%>
                <th>操作</th>
            </tr>

            <c:forEach items="${requestScope.list.data}" var="be">
                <tr class="t_body">
                        <td class="id">${be.id}</td>
                        <td class="bname">${be.bname}</td>
                        <td class="bType">${be.bType}</td>
                        <td class="code">${be.code}</td>
                        <td class="regular">${be.regular}</td>
                        <td class="bContent">${be.bContent}</td>
                        <td class="bCondition">${be.bCondition}</td>
                        <td class="bDate">${be.bDate}</td>
                        <td class="servious">${be.servious}</td>
                        <td class="people">${be.people}</td>
                        <td class="coin">${be.coin}</td>
                        <td class="others1">${be.others1}</td>
                        <td class="remark">${be.remark}</td>
                        <td class="caozuo">
                        <input type="button" value="修改" onclick="findById(${be.id})"/>&nbsp;&nbsp;
                        <input type="button" value="删除" onclick="deleteByBehavior(${be.id})"/>&nbsp;&nbsp;
                        <input type="button" value="复制" onclick="copyOne(${be.id})"/>
                    </td>
                </tr>
            </c:forEach>

        </table>
    </form>
    <!-- 引入分页 -->
    <jsp:include page="jsp/page.jsp" flush="true">
        <jsp:param name="" value=""/>
    </jsp:include>
    <br>
    <div id="mask">
        <form action="addBehavior" method="post" class="add" id="behaviorForm1">
            <%--栅格--%>
                <div class="container">
                    <div class="row fot">
                        <div class="col-md-3 csyi">
                            <div> <span>姓名 <b>*</b>：&nbsp;</span>
                                <select name="bname">
                                    <c:forEach var="c" items="${sessionScope.users}">
                                        <option>${c.name}</option>
                                    </c:forEach>
                                </select></div>
                        </div>
                        <div class="col-md-3 csyi">
                            <div> <span>类型  <b>*</b>：&nbsp;</span>
                                <select name="bType" id="btype">
                                    <c:forEach items="${sessionScope.pa}" var="p">
                                        <option>${p.paramValue}</option>
                                    </c:forEach>
                                </select></div>
                        </div>
                        <div class="col-md-3 csyi">
                            <div> <span>规程编号 <b>*</b>:&nbsp;</span>
                                <input type="text" name="code" id="code"/></div>
                        </div>
                    </div>
                    <div class="row fot">
                        <div class="col-md-3 csyi">
                            <div><span>条款号 <b>*</b>: &nbsp;</span>
                                <input type="text" name="regular" id="regular"/></div>
                        </div>
                        <div class="col-md-3 csyi">
                            <div> <span>条款内容 : &nbsp;</span>
                                <input type="text" name="bContent"/></div>
                        </div>
                        <div class="col-md-3 csyi">
                            <div> <span>行为情况 : &nbsp;</span>
                                <input type="text" name="bCondition"/></div>
                        </div>
                    </div>
                    <div class="row fot">
                        <div class="col-md-3 csyi">
                            <div> <span>日期 <b>*</b>:&nbsp;</span>
                                <input type="date" name="bDate" id="bDate"/></div>
                        </div>
                        <div class="col-md-3 csyi">
                        <div> <span>严重度  <b>*</b>:&nbsp;</span>
                            <select name="servious" id="servious">
                                <c:forEach items="${sessionScope.servious}" var="se">
                                    <option>${se.paramValue}</option>
                                </c:forEach>
                            </select></div>
                    </div>
                    <div class="col-md-3 csyi">
                        <div><span>记录人:&nbsp;</span>
                            <select name="people">
                                <c:forEach var="c" items="${sessionScope.users}">
                                    <option>${c.name}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                </div>
                <div class="row fot">
                    <div class="col-md-3 csyi">
                        <div> <span>计划处罚金额 :&nbsp; </span>
                            <input type="text" name="coin" placeholder="" onkeyup="clearNoNum(this)"/></div>
                    </div>
                    <div class="col-md-3 csyi">
                        <div>
                            <span>已交处罚金额 :</span>
                            <input type="text" name="others1" onkeyup="clearNoNum(this)"/>
                        </div>
                    </div>
                    <div class="col-md-3 csyi">
                        <div><span>备注说明:&nbsp;</span>
                            <input type="text" name="remark"/>
                        </div>
                    </div>
                    <div class="row fot">
                        <div class="col-md-3">
                            <div></div>
                        </div>
                        <div class="col-md-3 ">
                            <div></div>
                        </div>
                        <div class="col-md-3 ">
                            <div><span class="attention">注：<b>* </b>为必填项</span></div>
                        </div>
                    </div>
                </div>
            <div class="add_btn"><input type="button" value="添加" id="button1"/></div>
        </form>
    </div>
</div>

</body>
</html>



